#include "ConfigParser.h"

#include <fstream>

#include <ezlogger_headers.hpp>

namespace Crows3D
{

   ConfigParser::ConfigParser(void)
   {
   }

   ConfigParser::~ConfigParser(void)
   {
   }

   bool ConfigParser::LoadGraphicsSetupParameters(std::string configFileName, GraphicsSetupParameters& parameters)
   {
      std::ifstream file(configFileName.c_str());

      EZLOGGERSTREAM << "Reading Graphics configuration data from config file: " << configFileName << std::endl;

      // Make sure it opened
      if (!file.is_open())
      {
         EZLOGGERSTREAM << "ERROR: Open config file" << std::endl;

         return false;
      }

      file >> parameters.width >> parameters.height;
      file >> std::boolalpha >> parameters.vsync >> std::boolalpha  >> parameters.windowed;


      file.close();

      return true;
   }

}